-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Dependency resolution #3811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Dependency resolution #3811
Conversation
…nto block-exporter-initial
…nto dependency-resolution
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub(super) struct Block { | ||
pub(super) dependencies: DependencySet, | ||
pub(super) destinatons: BTreeSet<DestinationId>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: destinatons (same below)
synchronized_blocks: HashSet::new(), | ||
synchronized_blobs: HashSet::new(), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Just derive Default and use it
guard | ||
.save() | ||
.await | ||
.map_err(|e| Status::from_error(e.into()))?; | ||
} | ||
batch | ||
}; | ||
|
||
// after implementation of future destinations | ||
// this will be offloaded to a seperate thread. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: seperate
type Batch = Batch; | ||
type Error = ExporterError; | ||
|
||
async fn read_batch(&self, keys: Vec<Self::Key>) -> Result<Self::Batch, Self::Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like you may want to use read_confirmed_blocks
and read_blobs
(plural) here
/// The chain status, by chain ID. | ||
state: ReentrantCollectionView<C, ChainId, ChainStatusView<C>>, | ||
/// The block(and blob) index. | ||
index: MapView<C, Key, Value>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why mixing blocks and blobs vs using two maps?
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub(super) struct Block { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Block
, Blob
, Batchare used in different parts of the codebase with a different meaning. Can we use something different, maybe
ExporterBlock,
ExporterBlob, ExporterBatch
if we don't have any better idea?
match result { | ||
None => Ok(None), | ||
Some(Value::Blob(blob)) => Ok(Some(blob)), | ||
_ => Err(ViewError::InconsistentEntries), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my question about the two maps
Motivation
Since linera is a directed acyclic graph, a block may depend on any number of blocks ancestrally or in parallel. For a working block exporter a block must be exported along with its set of all dependencies.
Proposal
Dependency resolution for the linera-exporter.
The testing can be done in a more extensive, exhaustive and randomized manner. This will have to be revisited in the future.
The unit test module can also use some re-factorization, this can be done in a separate PR, along with the rest of the binary crate.
This PR will also successfully close #3666.
Test Plan
unit tests